interface KHTMLElement {
    /**
     * 事件发布
     * @see HTMLElement.prototype.dispatchEvent
     * @param type 事件键
     * @param detail 事件信息
     * @returns 当前元素对象
     */
    action(type: string, detail?: any): KHTMLElement;
}
{
    Object.defineProperty(KHTMLElement.prototype, 'action', {
        writable: false,
        configurable: false,
        enumerable: false,
        value: U.F.overloading('DOM-action',
            {
                types: [Etype.string],
                fn: function (this: KHTMLElement, type: string) {
                    this.elements.forEach(ele => { ele.dispatchEvent(new Event(type)); });
                    return this;
                }
            },
            {
                types: [Etype.string, U.F.argType.any],
                fn: function (this: KHTMLElement, type: string, detail: any) {
                    this.elements.forEach(ele => { ele.dispatchEvent(new CustomEvent(type, { detail: detail })); });
                    return this;
                }
            },
        )
    });
}
